package cn.kgc.cjk_yy.service.impl;

import cn.kgc.cjk_yy.mapper.BackendUserMapper;
import cn.kgc.cjk_yy.pojo.AppInfo;
import cn.kgc.cjk_yy.pojo.BackendUser;
import cn.kgc.cjk_yy.pojo.DataDictionary;
import cn.kgc.cjk_yy.service.BackendUserService;
import cn.kgc.cjk_yy.tools.PageDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BackendUserServiceImpl implements BackendUserService {

    @Resource
    private BackendUserMapper backendUserMapper;

    /*系统管理员的登录*/
    @Override
    public BackendUser backend_user_login(String userCode, String password) throws Exception {
        BackendUser user=new BackendUser();
        user.setUserCode(userCode);
        user.setUserPassword(password);
        return backendUserMapper.backendUserQueryALL(user);
    }

    /*用户模糊查询用户列表信息*/
    @Override
    public PageDto selectPage(String pagenum, AppInfo appInfo) {
        int pageno=1;
        if(pagenum!=null && pagenum.matches("\\d")){
            pageno=Integer.parseInt(pagenum);
        }
        int count=backendUserMapper.count(appInfo);
        PageDto pageDto=new PageDto<AppInfo>(pageno,count);
        pageDto.setQuerydata(appInfo);
        List<AppInfo> list= backendUserMapper.selectPage(pageDto);
        pageDto.setList(list);
        return pageDto;
    }



}
